package com.token.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaCheckRole;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.token.common.ResultMessage;
import com.token.model.dto.BaseDTO;
import com.token.model.vo.SysRoleVO;
import com.token.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @auther: henriy
 * @Date: 2023/10/25
 */
@Api(tags = "角色接口类")
@RestController
@RequestMapping("/role/info")
public class RoleController {

    @Resource
    private RoleService roleService;

    @SaCheckPermission("role_query")
    @SaCheckRole("admin")
    @PostMapping("/page")
    @ApiOperation("角色分页列表")
    public ResultMessage<IPage<SysRoleVO>> page(@RequestBody @Validated BaseDTO baseDTO) {
        return ResultMessage.isOk(roleService.page(baseDTO));
    }

}
